<%@ attribute name="name" required="true"%>
<%@ attribute name="items" required="true"%>
<%@ attribute name="attr"%>
<%@ attribute name="selected"%>
<%@ attribute name="blocked"%>
<%@ attribute name="disabled"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<c:set var="index" value="${0}" scope="page"/>
<c:choose>
 	<c:when test="${blocked}">
		<c:forTokens items="${items}" delims="," var="item" >
			<c:if test="${selected==index}">
				<c:out value="${item}" />
			</c:if>
			<c:set var="index" value="${index+1}" scope="page"/>
		</c:forTokens>
 	</c:when>
	<c:otherwise>
		<select name="${name}" ${attr}>
		<c:forTokens items="${items}" delims="," var="item">
			<OPTION VALUE='${index}' ${selected==index ? 'SELECTED':''} ${fn:containsIgnoreCase(disabled,index) && selected!=index ? 'DISABLED':''}>
				<c:out value="${item}" />
			</OPTION>
			<c:set var="index" value="${index+1}" scope="page"/>
		</c:forTokens>
		</select>
	</c:otherwise>
</c:choose>